ubuntu 建站


##1. 安装apache
①sudo apt-get update
②sudo apt-get install apache2

1
2
3
4
5
6
7
8
9
10
11
12
13
附录:apache的操作
//启动apache服务
# /etc/init.d/apache2 start
//or
$ sudo /etc/init.d/apache2 start
//重启apache服务
# /etc/init.d/apache2 restart
//or
$ sudo /etc/init.d/apache2 restart
//停止apache服务
# /etc/init.d/apache2 stop
//or
$ sudo /etc/init.d/apache2 stop

##2. 安装php
①sudo apt-get install php5

##3. 配置APACHE+PHP
①sudo apt-get install libapache2-mod-php5
②重启apache
sudo /etc/init.d/apache2 restart

##4. 安装mysql(密码118417)
①sudo apt-get install mysql-server
②sudo apt-get install php5-mysql

##5. 安装graphviz
sudo apt-get install graphviz

##6.登陆mysql
①启动:/etc/init.d/mysql start
②mysql -u root -p

service mysql restart

##7. 数据导入
①创建两个数据库
create database tweet;
create database tweet_topic;
②导入数据
mysql -u root -p tweet < /home/hadoop/tweet_export.sql

mysql -u root -p tweet_topic < /home/hadoop/tweet_topic_export.sql

启动mysql:
方式一:sudo /etc/init.d/mysql start
方式二:sudo start mysql
方式三:sudo service mysql start
停止mysql:
方式一:sudo /etc/init.d/mysql stop
方式二:sudo stop mysql
方式san:sudo service mysql stop
重启mysql:
方式一:sudo/etc/init.d/mysql restart
方式二:sudo restart mysql
方式三:sudo service mysql restart、

  1. 导入.sql文件数据 【在确保导入前后,mysql的编码设置相同的前提下,导入数据】

mysql –u root -p
source /home/wwwftp/comm.sql 【直接导入,不需要 use xxxx】
show databases; 【检查数据库导入成功】

1.导出一个表
mysqldump -u 用户名 -p 数据库名 表名> 导出的文件名
mysqldump -u wcnc -p smgp_apps_wcnc users> wcnc_users.sql
2.导出一个数据库结构
mysqldump -u wcnc -p -d –add-drop-table smgp_apps_wcnc >d:\wcnc_db.sql

-d 没有数据 –add-drop-table 在每个create语句之前增加一个drop table

mysqldump -u wcnc -p smgp_apps_wcnc users> wcnc_users.sql
mysqldump -u root -p tweet

http://blog.fens.me/linux-mongodb-install/

http://qinxuye.me/article/cola-a-distributed-crawler-framework/

将数据库表导出:
mysqldump -u root -p tweet > /var/test111/tweet.sql//太大了 分开导入
mysqldump -u root -p tweet_topic > /var/test111/tweet_topic.sql

mysqldump -u root -p tweet ID_TIME > /home/chen/mysqlfile/ID_TIME.sql;
mysqldump -u root -p tweet geo > /home/chen/mysqlfile/geo.sql;
mysqldump -u root -p tweet hmrepresentset > /home/chen/mysqlfile/hmrepresentset.sql;
mysqldump -u root -p tweet methodresult > /home/chen/mysqlfile/methodresult.sql;
mysqldump -u root -p tweet topicendtime > /home/chen/mysqlfile/topicendtime.sql;
mysqldump -u root -p tweet topiclistoftweet > /home/chen/mysqlfile/topiclistoftweet.sql;
mysqldump -u root -p tweet topicneighbors > /home/chen/mysqlfile/topicneighbors.sql;
mysqldump -u root -p tweet topicnumoftweet > /home/chen/mysqlfile/topicnumoftweet.sql;
mysqldump -u root -p tweet topicstarttime > /home/chen/mysqlfile/topicstarttime.sql;